<?php

/**
 * Year actions.
 *
 * @package    sf_sandbox
 * @subpackage Year
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12479 2008-10-31 10:54:40Z fabien $
 */
class yearActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
    $this->year_list = Doctrine::getTable('Year')
      ->createQuery('a')
      ->orderBy('a.id DESC')
      ->execute();

    $this->form = new YearForm(YearTable::getDefaultNextYear());
  }
  public function executeShow(sfWebRequest $request)
  {
    $this->forward404Unless($this->year = Doctrine::getTable('Year')->find(array($request->getParameter('id'))), sprintf('Object year does not exist (%s).', array($request->getParameter('id'))));
  }
  public function executeCreate(sfWebRequest $request)
  {
    YearTable::createYear();
    $this->redirect("year/index");
  }
}
